import java.sql.ResultSet;
import java.sql.SQLException;


public class NumberedResultSetTableModel extends ResultSetTableModel {

	public NumberedResultSetTableModel(ResultSet rs) {
		super(rs);
	}
	
	@Override
	public String getColumnName(int column) {
		if(column==0) return "";
		else return super.getColumnName(column-1);
	}
	
	@Override
	public int getColumnCount() {
		return super.getColumnCount()+1;
	}

	@Override
	public Object getValueAt(int row, int col) {
		if(col==0) {
			return row+1;
		}
		Object obj=null;
		try {
			resultSet.absolute(row+1);
			obj=resultSet.getObject(col);
		} catch (SQLException e) {
			e.printStackTrace();
		}
		//System.err.println(obj);
		return obj;
	}
}
